#!/bin/bash

checkThread() {

    threadIds=$(ps -ef | grep $1 | grep $2 | grep java | grep -v 'grep' | awk '{print $2}')
    echo '[info] will kill threadIds : ' $threadIds
    
    for itemP in $threadIds
    do
        itemThreadId=$itemP
        break
    done
    
    if [ $itemThreadId ]
    then
        kill -9 $itemThreadId
        echo '[info] killed threadId : ' $threadIds
    else
        echo '[info] not threadId : ' $itemThreadId
    fi
}

checkThread hyou-sc-config-server-1.0.0.jar server.port=35000
